﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace BabyShop
{
    public partial class Product : System.Web.UI.Page
    {
        public DataRow dr;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (string.IsNullOrWhiteSpace(Request["id"]))
                {
                    Response.Redirect("/");
                }
                string sql = "select products.*,categories.name as cat_name,brands.name as brand_name from products join categories on categories.id = products.category_id join brands on brands.id = products.brand_id where products.id = {0}";
                sql = string.Format(sql,Request["id"]);
                DataTable dt = DB_Provider.Read(sql);
                if (dt.Rows.Count > 0)
                    dr = dt.Rows[0];
                else
                    Response.Redirect("/");
            }
        }
    }
}